package com.globalwave.common;

import java.util.HashMap;

/**
 * 在一个线程中，作数据传输的
 * 
 * @author Virgil.Chen
 *
 */
public class ThreadContext extends HashMap<Short, Object> {
	
    /**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	public static final Short STATEMENT_MANAGER = (short)0 ;
	
	private static ThreadLocal<ThreadContext> tl=new ThreadLocal<ThreadContext> ();
    
    public static ThreadContext get(){
    	return tl.get() ;
    }
    public static void set(ThreadContext context){
        tl.set(context);
    }
   
    public static ThreadContext getNotNull() {
    	ThreadContext t = tl.get() ;
    	
    	if (t == null) {
    		t = new ThreadContext() ;
    		set(t) ;
    	}
    	
    	return t ;
    }
    
}
